package com.dxg.msns.common.pojo;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;

/**
 * 动态点赞实体类
 * 对应数据库表：dynamic_like
 * 
 * @author system
 */
@Table(name = "dynamic_like")
public class DynamicLike implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID自增
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 点赞者ID
     */
    @Column(name = "liker_id")
    private String likerId;

    /**
     * 动态ID
     */
    @Column(name = "dynamic_id")
    private String dynamicId;

    /**
     * 文章发布者ID
     */
    @Column(name = "dynamic_authorId")
    private String dynamicAuthorId;

    /**
     * 点赞时间
     */
    @Column(name = "like_date")
    private Date likeDate;

    /**
     * 状态：0-不存在，1-未读，2-已读
     */
    @Column(name = "status")
    private String status;

    // 构造方法
    public DynamicLike() {
    }

    public DynamicLike(String likerId, String dynamicId, String dynamicAuthorId) {
        this.likerId = likerId;
        this.dynamicId = dynamicId;
        this.dynamicAuthorId = dynamicAuthorId;
        this.likeDate = new Date();
        this.status = "1";
    }

    // Getter 和 Setter 方法
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLikerId() {
        return likerId;
    }

    public void setLikerId(String likerId) {
        this.likerId = likerId;
    }

    public String getDynamicId() {
        return dynamicId;
    }

    public void setDynamicId(String dynamicId) {
        this.dynamicId = dynamicId;
    }

    public String getDynamicAuthorId() {
        return dynamicAuthorId;
    }

    public void setDynamicAuthorId(String dynamicAuthorId) {
        this.dynamicAuthorId = dynamicAuthorId;
    }

    public Date getLikeDate() {
        return likeDate;
    }

    public void setLikeDate(Date likeDate) {
        this.likeDate = likeDate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "DynamicLike{" +
                "id=" + id +
                ", likerId='" + likerId + '\'' +
                ", dynamicId='" + dynamicId + '\'' +
                ", dynamicAuthorId='" + dynamicAuthorId + '\'' +
                ", likeDate=" + likeDate +
                ", status='" + status + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        DynamicLike that = (DynamicLike) o;

        if (!likerId.equals(that.likerId))
            return false;
        return dynamicId.equals(that.dynamicId);
    }

    @Override
    public int hashCode() {
        int result = likerId.hashCode();
        result = 31 * result + dynamicId.hashCode();
        return result;
    }
}